package io.renren.modules.shippingoutlets.service.impl;

import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.shippingoutlets.dao.ShippingOutletsDao;
import io.renren.modules.shippingoutlets.entity.ShippingOutletsEntity;
import io.renren.modules.shippingoutlets.service.ShippingOutletsService;


@Service("shippingOutletsService")
public class ShippingOutletsServiceImpl extends ServiceImpl<ShippingOutletsDao, ShippingOutletsEntity> implements ShippingOutletsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ShippingOutletsEntity> shippingOutletsEntityQueryWrapper = new QueryWrapper<>();
        if (StrUtil.isNotBlank((String)params.get("shippingoutletsname"))){
            shippingOutletsEntityQueryWrapper.lambda().like(ShippingOutletsEntity::getShippingoutletsname,(String)params.get("shippingoutletsname"));
        }
        shippingOutletsEntityQueryWrapper.lambda().orderByDesc(ShippingOutletsEntity::getCreatetime);
        IPage<ShippingOutletsEntity> page = this.page(
                new Query<ShippingOutletsEntity>().getPage(params),
                shippingOutletsEntityQueryWrapper
        );
        return new PageUtils(page);
    }

}